package com.wise.summer.v1.cms.content.upload;

import com.alibaba.fastjson.annotation.JSONField;
import com.wise.framework.annotations.ApiInfo;
import com.wise.framework.annotations.Publish;
import com.wise.framework.annotations.SkipRequestBodyAnnotation;
import com.wise.framework.annotations.validation.NotBlank;
import com.wise.framework.annotations.validation.NotNull;
import com.wise.framework.summer.BasicSummer;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;

import static com.wise.model.content.ContentErrMsgs.Err_000100140017;
import static com.wise.model.content.ContentErrMsgs.Err_000100140018;

@ApiInfo("upload")
@Publish
@SkipRequestBodyAnnotation
@Getter
@Setter
public class AddUpload extends BasicSummer<AddUpload.UploadResult> {
    @NotNull(msg = Err_000100140017)
    @ApiInfo("文件")
    @JSONField(serialize=false)
    private  Object file;

    @NotBlank(msg = Err_000100140018)
    @ApiInfo("所属分组")
    private String groupId;

    @ApiInfo("资源链接的媒体文件访问地址")
    private  String resourcePath;

    @ApiInfo("资源类型")
    private Integer resourceType;

    @Getter
    @Setter
    @Builder
    public static class UploadResult {

        @ApiInfo("OSS上传文件路径")
        private String url;

        @ApiInfo("上传文件GUID")
        private String id;

        @ApiInfo("资源原名称")
        private String originResourceName;
    }
}
